package com.graduationproject.examonline.exam.controller;

import com.graduationproject.examonline.exam.service.ExamService;
import com.graduationproject.examonline.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("api/exam")
public class ExamController {

    @Autowired
    private ExamService examService;

    @PostMapping("/insertExam")
    public Result insertExam(@RequestBody Map<String, Object> params) {
        return examService.insertExam(params);
    }

    @GetMapping("/getExamListByTeachId")
    public Result getExamListByTeachId(String teach_id){
        return examService.getExamListByTeachId(teach_id);
    }

    @PostMapping("/updateExamByExamId")
    public Result updateExamByExamId(@RequestBody Map<String, Object> params){
        return examService.updateExamByExamId(params);
    }

    @GetMapping("/getExamListByStuId")
    public Result getExamListByStuId(String stu_id){
        return examService.getExamListByStuId(stu_id);
    }

    @GetMapping("/getStudentByExamId")
    public  Result getStudentByExamId(String exam_id){
        return examService.getStudentByExamId(exam_id);
    }
}
